import type { articleInter, articleData } from '@/types/article';
import request, { type Data } from '@/utils/request'

// 所有文章列表查询
export const articleListService = (params: any) => {
  return request.get<Data<articleData>>('/article', { params: params })
}
// 当前用户文章列表查询
export const userArticleListService = (parmas: any) => {
  return request.get<Data<articleData>>('/article/userArticles', { params: parmas })
}
// 添加文章
export const addArticleService = (articleModel: articleInter) => {
  return request.post<Data<object>>('/article', articleModel)
}
// 删除文章
export const deleteArticleService = (id: number) => {
  return request.delete<Data<object>>("/article", { params: { id } })
}
// 更新文章
export const updateArticleService = (articleData: articleInter) => {
  return request.put<Data<object>>("/article", articleData)
}